package com.library.librarybackend.domain.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * @author 平
 * @description 排序方式枚举类
 * @since 2025-09-21 20:36
 */
@Getter
public enum SortTypeEnum {
    DEFAULT(0, "默认(上架时间)"),
    DOWNLOAD_COUNT(1, "下载次数"),
    READ_COUNT(2, "阅读次数"),
    PUBLISH_YEAR(3, "出版时间");

    private final Integer value;
    private final String desc;

    SortTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static Boolean isExist(Integer value) {
        return Arrays.stream(SortTypeEnum.values()).anyMatch(sortTypeEnum -> sortTypeEnum.value.equals(value));
    }


}
